package com.poorstu.dao.impl;

import java.util.List;

import com.common.base.dao.impl.BaseDaoImpl;
import com.poorstu.dao.FlowDao;
import com.poorstu.model.FlowLineMod;
import com.poorstu.model.FlowMod;

public class FlowDaoImpl extends BaseDaoImpl implements FlowDao {

	
	
	public List<FlowMod> selectFlowAll() {
		return super.findAll("FlowMod");
	}

	public List<FlowLineMod> selectFlowLineByFlowId(int flowId) {
		
		return super.findByHql("from FlowLineMod where flowId="+flowId +"order by orders");
	}

	public FlowMod selcetFlowById(int flowId) {
		
		return (FlowMod)super.findByHql("from FlowMod where flowId="+flowId).get(0);
	}

	public void saveFlowLine(FlowLineMod flowLine) {
		super.save(flowLine);
		
	}

	public void updateFlowLine(FlowLineMod flowLine) {
		
		super.merge(flowLine);
		
	}

	public FlowLineMod selectFlowLineById(int flowLineId) {
		return (FlowLineMod)super.findByHql("from FlowLineMod where flowlId="+flowLineId).get(0);
		
	}

	public void deleteFlowLine(FlowLineMod flowLine) {
		super.delete(flowLine);
	}

	public void updateFlow(FlowMod flowMod) {
		super.merge(flowMod);
	}

	public void savaFlow(FlowMod flowMod) {
		super.save(flowMod);
		
	}

	public void deleteFlow(FlowMod flowMod) {
			super.delete(flowMod);
	}

	public int selectOder(int flowId) {
		
		
		return (Integer)super.findByHql("select max(orders) from FlowLineMod where flowId="+flowId).get(0);
	}
	
	
	
	
		
	

	
	
}
